#!/usr/bin/env python
# encoding: utf-8
"""
testutils.py

Created by Orestis Markou on 2007-12-14.
Copyright (c) 2007 Orestis Markou. All rights reserved.
"""


def print_sequence(seq,depth=0):
    """docstring for print_sequence"""
    if isinstance(seq, basestring): 
        # if  depth: print '',
        print seq.encode('utf-8'),',',
        return
    try: 
        iter(seq)  
        if depth: print '\n',  '\t'*depth, 
        print '(',
    except TypeError:
        print str(seq).encode('utf-8'),',',
        # depth-=1
        return
    depth+=1  
    for el in seq:
        print_sequence(el,depth)
    depth-=1
    
    print '\t'*depth,')'
    
        
if __name__ == '__main__':
    print_sequence(['a','b','c'])
    print_sequence(['a','b',('c','d')])
    print_sequence(['a','b',('c','d', ('e','f'))])
    print_sequence([u'ορεστης',(1,2,3),'b',('c','d', ('e','f'))])